function [L A R]=corr1(I)
 [rows,cols]=size(I);
 [x,y] = meshgrid(1:rows,1:cols);
 
 
 M=64;
 N=360;
% F=double(zeros(2*M,N));
  
 I1 = I.*((-1).^(x+y));            
 Tf=(fft2(I1));
 im=LPM(I);
  
 magF=(sqrt(real(im).^2 + imag(im).^2));
 faseF=atan2(imag(im),real(im));
 
 L1=magF.*exp(1j*faseF);
 L2=real(ifft2(L1));
 [r,c]=size(L2);
 [x,y] = meshgrid(1:c,1:r);
 F = L2.*((-1).^(x+y));
 
  
 L=im;
  
 RT=zeros(5,1);
 
 for key=1:50
   RandStream.setDefaultStream(RandStream('mt19937ar','seed',key));
   W=-1 + (1-(-1)).*rand(M/2,N/2);
   W2=upsampled(W);  
   g=LPM(W2);  
 
   Res=xcorr2(im,g);
   RT(key)=max(max(Res));
 end
  
  [a b]=max(RT);
  R=num2str(b);
  A=RT;
  

end